package com.fwmagic.spark.core.action

import org.apache.spark.{SparkConf, SparkContext}

/**
  * saveAsTextFile用于将RDD以文本文件的格式存储到文件系统中
  */
object SaveAsTextFileDemo {
    def main(args: Array[String]): Unit = {
        val conf = new SparkConf()
                .setAppName(this.getClass.getSimpleName)
                .setMaster("local[*]")

        val sc = new SparkContext(conf)

        val rdd = sc.makeRDD(1 to 10)

        rdd.saveAsTextFile("file:///tmp/data")

        sc.stop()
    }
}
